
import Vue from 'vue'
import App from './App'
import {imgBaseURL,userInfoStorage,imgWxkjUrl} from 'common/utils/config.js'
import shareUtils from 'common/utils/shareUtils.js'
import {showToast,fangBaoClick,removeEmptyProperty} from 'common/utils/util.js'
import uView from 'uni_modules/uview-ui';
import navigationBar from "@/components/navigationBar/navigationBar.vue";
import { systemInfo } from '@/mixins/mixin.js'
import dayjs from 'dayjs'
import lodash from 'lodash'
import store from 'store/store.js'
import {STORE_VAR,SUBSCRIBE_CODES,dictMap} from '@/common/dict.js'
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter'


import uma from 'umtrack-wx';
uma.init({
  appKey: '683549e479267e02107137c1', //由友盟分配的APP_KEY
  // 使用Openid进行统计，此项为false时将使用友盟+uuid进行用户统计。
  // 使用Openid来统计微信小程序的用户，会使统计的指标更为准确，对系统准确性要求高的应用推荐使用Openid。
  useOpenid: true,
  // 使用openid进行统计时，是否授权友盟自动获取Openid，
  // 如若需要，请到友盟后台"设置管理-应用信息"(https://mp.umeng.com/setting/appset)中设置appId及secret
  autoGetOpenid: true,
  debug: false, //是否打开调试模式
  uploadUserInfo: true // 自动上传用户信息，设为false取消上传，默认为false
})

// 此处用来挂载入uma到组件实例上，方便组件内使用this.$uma
uma.install =function(Vue){
  Vue.prototype.$uma = uma;
}



Vue.use(uma);

Vue.use(uView);
Vue.mixin(shareUtils)
Vue.component('navigationBar',navigationBar)

//防爆防抖点击
Vue.prototype.$fangBaoClick = fangBaoClick
Vue.prototype.$userInfoStorage = userInfoStorage
Vue.prototype.imgBaseURL = imgBaseURL
Vue.prototype.$imgWxkjUrl = imgWxkjUrl

Vue.prototype.$showToast = showToast
Vue.prototype.$CONST = STORE_VAR
Vue.prototype.$SUBSCRIBE_CODES = SUBSCRIBE_CODES

dayjs.extend(isSameOrAfter)
Vue.prototype.$dayjs = dayjs
Vue.prototype.$lodash = lodash//lodash
Vue.prototype.$dictMap = dictMap
Vue.prototype.$removeEmptyProperty = removeEmptyProperty
//Vue.prototype.$isPC = ['windows', 'macos'].includes(uni.getSystemInfoSync().osName)


Vue.prototype.$store = store
Vue.prototype.$onLaunched = new Promise(resolve => {
  console.log('$onLaunched')
  Vue.prototype.$isResolve = resolve
})

Vue.mixin(systemInfo)

//导入公共引用全局的信息
import commonStaticJs from 'common/js/common.js'
Vue.mixin(commonStaticJs)

App.mpType = 'app'
const app = new Vue({
	...App
})
import httpApi from '@/common/http.api.js'
Vue.use(httpApi, app)

app.$mount()
